<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>一证通线索表 管理</title>
    <style type="text/css">
        .searchArea .fieldBox .label{width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">姓名</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">手机号</div>
                    <div class="field">
                        <input name="cstMp" id="cstMp" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">地区</div>
                    <div class="field">
                        <input name="rgnPrCd" id="rgnPrCd" data-value="" placeholder="请选择" ltype="combobox">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">意向车型</div>
                    <div class="field">
                        <input name="preferMdl" id="preferMdl" type="text" class="ui-textbox" value="" >
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">预算价款</div>
                    <div class="field">
                        <input name="budgetCd" id="budgetCd" data-value="" placeholder="请选择" ltype="combobox">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">提报时间</div>
                    <div class="field">
                        <input ligerui="width:85" name="beginCrtTm" id="beginCrtTm" type="text" class="ui-datepicker" value="">
                        -
                        <input ligerui="width:85" name="endCrtTm" id="endCrtTm" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">状态</div>
                    <div class="field">
                        <input name="stsCd" id="stsCd" data-value="" placeholder="请选择" ltype="combobox">
                    </div>
                </div>

                <div class="fieldBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
<!--                     <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
 -->                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, callback = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/yzt/yztTrackInfo/initList.do',
            method: 'get',
            columns: [
                {display: '客户名称', name: 'cstNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '客户手机号', name: 'cstMp', minWidth: 100, align: 'left', enabledSort: false},
                {display: '地区（省）', name: 'rgnPrCdNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '预算价款', name: 'budgetCdNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '意向车型', name: 'preferMdl', minWidth: 100, align: 'left', enabledSort: false},
                {display: '车辆品牌', name: 'vehBd', minWidth: 100, align: 'left', enabledSort: false},
                {display: '提报时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
                {display: '状态', name: 'stsCdNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '操作', name: '', minWidth: 100, align: 'left', enabledSort: false,
                    render:function (rowdata,rowindex,value) {
                        return '<a class="sq-button-hasicon" href="javascript:;" onclick="queryDtl('+rowdata.id+');"><i class="sqBtnIco_3"></i>查看</a>' +
                            '<a class="sq-button-hasicon" href="javascript:;" onclick="modify('+rowdata.id+');"><i class="sqBtnIco_3"></i>跟进</a>';
                    }
                },
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#rgnPrCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            autocomplete: function (e) {
                filter_autoComboboxData(e.key, this);
                e.show();
            },
        });
        liger.get("rgnPrCd").setData(${rgnPrCdList});
        $("#budgetCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        liger.get("budgetCd").setData(${budgetCdList});
        $("#stsCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        liger.get("stsCd").setData(${stsCdList});

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });

        callback = function () {
            grid.reload();
        };

    });

    function modify(_rowId){
        var row=grid.getRow(_rowId);
        $.ligerDialog.open({
            width: 750,
            height: 360,
            title: '线索跟进',
            url: '<%=path%>/yzt/yztTrackInfo/toModifyPage.do?id=' + _rowId
        });
    }

    function queryDtl(_rowId){
        var row=grid.getRow(_rowId);
        $.ligerDialog.open({
            width: 750,
            height: 360,
            title: '线索详情',
            url: '<%=path%>/yzt/yztTrackInfo/toDtlPage.do?id=' + _rowId
        });
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

</script>

</body>
</html>
